<template>
    <el-dialog title="" visible :show-close="false" class="wrap" size="tiny">
       <i class="el-icon-close close" @click="cancel" style="color: white;z-index: 99;"></i>
		 <div class="bt">结算</div>
        <el-form label-width="100px" class="form">
            <el-form-item label="老师名称">
                <el-input v-model="params.row.zwm" :readonly="true" class="select-block"></el-input>
            </el-form-item>
             <el-form-item label="未结算课时">
                <el-input v-model="params.row.wjsks" :readonly="true" class="select-block"></el-input>
            </el-form-item>
            <el-form-item label="结算课时">
                <el-input v-model="form.jxks" class="select-block"></el-input>
            </el-form-item>
            <el-form-item label="结算金额">
                <el-input v-model="form.jxje" class="select-block"></el-input>
            </el-form-item>
        </el-form>
        <el-button type="info" class="submit" @click="submit">结算</el-button>
    </el-dialog>
</template>

<script type="text/javascript">
    export default {
        props: ['params'],
        data () {
            return {
                form: {
                    lsid: '',
                    jxks: '',
                    jxje: '',
                    id:''
                },
            }
        },
        created () {
            // console.log(this.params)
             this.form.id=this.params.id;
        },
        methods: {
            submit () {
                this.$store.state.loading = true;
//              if (!this.form.chinese) {
//                  this.$message.warning('请填写老师中文名');
//                  return;
//              }else if(!this.form.type){
//                  this.$message.warning('请选择老师类型');
//                  return;
//              }else if(!this.form.school){
//                  this.$message.warning('请选择学校');
//                  return;
//              }
	var logininfo = JSON.parse(localStorage.logininfo);
                this.axios.get( this.$store.state.api + 'lsks/updatelsks', {
                    params: {
                        lsid: this.params.row.lsid+'',
                        jxks: this.form.jxks+'',
                        jxje: this.form.jxje+'',
                        xxid: logininfo.xxid+'',
                        yhid: logininfo.id+''
                    }
                }).then( res => {
                    console.log(res)
                    if (res.data.code == 1) {
                        this.$emit('close',{type:'edit',cancel:false});
                        this.$store.state.loading = false;
                    }else{
                        this.$emit('close',{type:'edit',cancel:false});
                        this.$store.state.loading = false;
                    }
                    
                }).catch( res => {
                    console.log(res)
                    this.$emit('close',{type:'edit',cancel:false});
                    this.$store.state.loading = false;
                })
            },
            getTime (val) {
                this.form.time = val;
            },
            cancel () {
                this.$emit('close',{type:'edit',cancel:true})
            },
        }
    }
</script>

<style lang="less" scoped>
    .wrap {
        text-align: center;
    }
   .bt{
			position: absolute;
			width: 100%;
			height: 50px;
			margin: 0 auto;
			top:0;
			left:0;
			background: #50BFFF;
			margin-bottom: 20px;
			color:white;
			text-align:left;
			line-height: 50px;
			font-size: 17px;
			padding-left: 15px;
		}
    .form {
        text-align: left;
        margin-top: 20px;

    }
    .input {
             display: inline-block;
         }
    .select-block {
        display: block;
        width: 85%;
    }
    .submit {
        width: 120px;
    }
</style>